package com.ruoyi.mes.service.impl;

import java.util.List;
import com.ruoyi.common.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.mes.mapper.MesPmWorkorderMapper;
import com.ruoyi.mes.domain.MesPmWorkorder;
import com.ruoyi.mes.service.IMesPmWorkorderService;

/**
 * 生产工单Service业务层处理
 * 
 * @author Elon
 * @date 2023-09-03
 */
@Service
public class MesPmWorkorderServiceImpl implements IMesPmWorkorderService 
{
    @Autowired
    private MesPmWorkorderMapper mesPmWorkorderMapper;

    /**
     * 查询生产工单
     * 
     * @param workorderId 生产工单主键
     * @return 生产工单
     */
    @Override
    public MesPmWorkorder selectMesPmWorkorderByWorkorderId(Long workorderId)
    {
        return mesPmWorkorderMapper.selectMesPmWorkorderByWorkorderId(workorderId);
    }

    /**
     * 查询生产工单列表
     * 
     * @param mesPmWorkorder 生产工单
     * @return 生产工单
     */
    @Override
    public List<MesPmWorkorder> selectMesPmWorkorderList(MesPmWorkorder mesPmWorkorder)
    {
        return mesPmWorkorderMapper.selectMesPmWorkorderList(mesPmWorkorder);
    }

    /**
     * 新增生产工单
     * 
     * @param mesPmWorkorder 生产工单
     * @return 结果
     */
    @Override
    public int insertMesPmWorkorder(MesPmWorkorder mesPmWorkorder)
    {
        mesPmWorkorder.setCreateTime(DateUtils.getNowDate());
        return mesPmWorkorderMapper.insertMesPmWorkorder(mesPmWorkorder);
    }

    /**
     * 修改生产工单
     * 
     * @param mesPmWorkorder 生产工单
     * @return 结果
     */
    @Override
    public int updateMesPmWorkorder(MesPmWorkorder mesPmWorkorder)
    {
        mesPmWorkorder.setUpdateTime(DateUtils.getNowDate());
        return mesPmWorkorderMapper.updateMesPmWorkorder(mesPmWorkorder);
    }

    /**
     * 批量删除生产工单
     * 
     * @param workorderIds 需要删除的生产工单主键
     * @return 结果
     */
    @Override
    public int deleteMesPmWorkorderByWorkorderIds(Long[] workorderIds)
    {
        return mesPmWorkorderMapper.deleteMesPmWorkorderByWorkorderIds(workorderIds);
    }

    /**
     * 删除生产工单信息
     * 
     * @param workorderId 生产工单主键
     * @return 结果
     */
    @Override
    public int deleteMesPmWorkorderByWorkorderId(Long workorderId)
    {
        return mesPmWorkorderMapper.deleteMesPmWorkorderByWorkorderId(workorderId);
    }
}
